package com.sunshine.ssm.multithreading;

/**
 * @Author: WeiHong
 * @Date: 2017/5/17 16:31
 */
public class AddMoneyThread implements Runnable {

    //存入账号
    private Account account;

    //存入金额
    private double money;

    public AddMoneyThread(Account account, double money){
        this.account = account;
        this.money = money;
    }

    @Override
    public void run() {
        synchronized (account){
            account.deposit(money);
        }
    }
}
